import axios from 'axios'

const service = axios.create({
    // baseURL: 'http://localhost:5173/api-2.1.1',
    timeout: 60000,
    withCredentials: false,
    responseType: 'json'
})

service.interceptors.request.use(
    (config) => {
        config.headers.Authorization = 'Your Token'
        return config
    },
    (error) => Promise.reject(error)
)

service.interceptors.response.use(
    (response) => {
        console.log(response)
        return response.data
    },
    (error) => Promise.reject(error)
)

export default function request(config) {
    return service({
        method: config.method || 'get',
        url: config.url,
        params: config.params,
        data: config.data
    })
}
